# PyOpenSG is (C) Copyright 2005-2009 by Allen Bierbaum
#
# This file is part of PyOpenSG.
#
# PyOpenSG is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# PyOpenSG is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

do_full = False

# ------------ MATH TYPES ------------ #
# List of types for Vec types
if do_full:
   vec_types = ['ub', 'b', 'us', 's', 'f', 'd', 'ld']
   vec_sizes = [2, 3, 4]
else:
   vec_types = ['f', 'd', 'ub']
   vec_sizes = [2, 3, 4]

# List of types for Pnt types
if do_full:
   pnt_types = ['ub', 'b', 'us', 's', 'f', 'd', 'ld', 'fx']
   pnt_sizes = [2, 3, 4]
else:
   pnt_types = ['f', 'd']
   pnt_sizes = [2, 3, 4]

# Colors
color_types =  ['ub', 'f']
color_sizes = [3, 4]

type_map = {'ub':'OSG::UInt8',
             'b':'OSG::Int8',
            'us':'OSG::UInt16',
             's':'OSG::Int16',
             'f':'OSG::Real32',
             'd':'OSG::Real64',
            'ld':'OSG::Real128',
            'fx':'OSG::Fixed32',
        }

class MathTypeInfo(object):
   def __init__(self, type, alias, exposed_name, size, type_str):
      self.type = type
      self.alias = alias
      self.exposed_name = exposed_name
      self.size = size
      self.type_str = type_str
      
# Create VecStorage_typeinfo
# Full type, alias, module_name, size, template_type
vec_storage_typeinfo = []
for size in vec_sizes:
   for vtype in vec_types:
      vec_storage_typeinfo.append( MathTypeInfo("OSG::VecStorage%s<%s>"%(size,type_map[vtype]),
                                    "alias_VecStorage%s%s"%(size,vtype),
                                    "VecStorage%s%s"%(size,vtype),
                                    size, type_map[vtype]))

# Create SelectVecStorage_typeinfo
# Full type, alias, module_name, size, template_type
select_vec_storage_typeinfo = []
for size in vec_sizes:
   for vtype in vec_types:
      select_vec_storage_typeinfo.append(
         MathTypeInfo("OSG::SelectVecStorage<%s, %s>" % (type_map[vtype], size),
                      "alias_SelectVecStorage%s%s" % (size, vtype),
                      "SelectVecStorage%s%s" % (size, vtype),
                      size, type_map[vtype])
      )

# Vec types
# Note: We use the osg typedefed type for the base type
# Full type, alias, module_name, size, template_type
vec_typeinfo = []
for size in vec_sizes:
   for vtype in vec_types:
      vec_typeinfo.append( MathTypeInfo("OSG::Vec%s%s"%(size,vtype),
                            "alias_Vec%s%s"%(size,vtype),
                            "Vec%s%s"%(size,vtype),
                            size, type_map[vtype]) )

# Vec types
# Note: We use the osg typedefed type for the base type
# Full type, alias, module_name, size, template_type
pnt_typeinfo = []
for size in pnt_sizes:
   for ptype in pnt_types:
      pnt_typeinfo.append( MathTypeInfo("OSG::Pnt%s%s"%(size,ptype),
                            "alias_Pnt%s%s"%(size,ptype),
                            "Pnt%s%s"%(size,ptype),
                            size, type_map[ptype]) )

# Color types
# Note: We use the osg typedefed type for the base type
# Full type, alias, module_name, size, template_type
color_typeinfo = []
for size in color_sizes:
   for ctype in color_types:
      color_typeinfo.append( MathTypeInfo("OSG::Color%s%s"%(size,ctype),
                              "alias_Color%s%s"%(size,ctype),
                              "Color%s%s"%(size,ctype),
                              size, type_map[ctype]) )                            

# -------- GeoIntegral Types --------- #
geo_integral_types = ["UInt8", "UInt16", "UInt32"]
geo_integral_param_types = ["UInt32"]
geo_integral_prop_names = []
for itype in geo_integral_types:
   geo_integral_prop_names.append("Geo%sProperty"%itype)

# -------- GeoVec Types -------------- #
#geo_types = ["ub","b","us","s", "f", "d", "Nub", "Nb", "Nus","Ns"]
geo_types = ["f","d"]
color_types = ["Color3f","Color4f"]

geo_vec_prop_names = []
for prop_type in geo_types:
   for l in ["2", "3","4"]:
      for base_type in ["Vec","Pnt"]:
         geo_vec_prop_names.append("Geo%sProperty"% "%s%s%s"%(base_type,l,prop_type))

for c in color_types:
   geo_vec_prop_names.append("Geo%sProperty"%c)

# Get a list of the return types for geo vecs
geo_vec_get_value_ret_types = []

for vt in vec_types:
   if "fx" == vt:
      continue

   for s in vec_sizes:
      geo_vec_get_value_ret_types.append("OSG::Vec%s%s"%(s,vt))
for pt in pnt_types:
   if "fx" == vt:
      continue

   for s in pnt_sizes:
      geo_vec_get_value_ret_types.append("OSG::Pnt%s%s"%(s,pt))
geo_vec_get_value_ret_types.extend(["OSG::Color3f","OSG::Color4f"])

# ---------- SHL Variable Types ---------- #
shl_variable_types = ['bool', 'OSG::Int32', 'OSG::Real32', 'OSG::Vec2f', 'OSG::Vec3f',
                      'OSG::Vec4f', 'OSG::Matrix', 'OSG::Pnt2f', 'OSG::Pnt3f']
